package com.blb.zycommunity.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.zycommunity.entity.ZyUnit;
import com.blb.zycommunity.mapper.ZyUnitMapper;
import com.blb.zycommunity.service.IZyUnitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 单元  服务实现类
 * </p>
 *
 * @author chenheng
 * @since 2023-11-20
 */
@Service
public class ZyUnitServiceImpl extends ServiceImpl<ZyUnitMapper, ZyUnit> implements IZyUnitService {

    @Resource
    private ZyUnitMapper zyUnitMapper;

    @Override
    public IPage<ZyUnit> selectByAll(Long current, Long size,String unitName,String unitCode,String unitHaveElevator ,String buildingName,Long communityId) {
        IPage<ZyUnit> zyUnitIPage = zyUnitMapper.selectByAll(new Page<>(current, size),unitName,unitCode,unitHaveElevator,buildingName,communityId);
        return zyUnitIPage;
    }

    @Override
    public List<ZyUnit> findUnitByBuildingId(String buildingId) {
        return zyUnitMapper.selectUnitByBuildingId(buildingId);
    }
}
